class Solution {
public:
    int repeatedNTimes(vector<int>& nums) {
        unordered_map<int, int> us;
        for (auto& e : nums)
        {
            us[e]++;
        }

        int N = nums.size() / 2;
        for (auto& e : us)
        {
            if (e.second == N)
                return e.first;
        }
        return -1;
    }
};